package lab01;

import java.util.Scanner;

/**
 * Created by Lenovo on 2017/10/10.
 */
public class test12 {
    public static void main(String[] args) {
        int a1, a2, a3, a4, num;
        num = 0;
        System.out.println("请输入一个");
        Scanner sc = new Scanner(System.in);
        num = sc.nextInt();
        if (num >= 1 && num <= 10000) {
            a1 = num / 1000;
            a2 = (num / 1000) / 100;
            a3 = (num / 100) / 10;
            a4 = num % 10;
            if (a1 != 0) {
                System.out.println(num + "是四位数");
                if (a1 == a4 && a2 == a3) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else if (a2 != 0) {
                System.out.println(num + "是三位数");
                if (a2 == a4) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else if (a3 != 0) {
                System.out.println(num + "是二位数");
                if (a3 == a4) {
                    System.out.println(num + "是回文");
                } else {
                    System.out.println(num + "不是回文");
                }
            } else {
                System.out.println(num + "是一位数");
                System.out.println(num + "是回文");
            }
        } else {
            System.out.println("该数不在1-9999之间，请重新输入！！！");
        }
    }
}
